We are used to counting "base 10". This means that we use powers of 10 to represent successive digits in numbers. We have a units column, a tens column, a hundreds column, a thousands column and so on. We know that 123 is a hundred plus two tens and three units.

The digital circuits that we are using represent a value as patterns of bits. Because each bit can only have two values, 0 or 1 (unlike decimal where each digit can have the ten values 0 - 9) we say that digital circuits work to base two (or binary).

The table shows eight bits, numbered from 7 to 0. Bit 0 is the least significant bit (LSB) and bit 7 is the most significant bit (LSB). As in decimal numbers, the least significant digit is given at the right hand edge of the number.

Each bit in a binary number represents a power of two. I can represent a value, up to the capacity of the number of bits I've got, as a particular pattern of bits:

10110101

- would convert to decimal as (1128) + (064) + (132) + (116) + (08) + (14) + (02) + (11) - giving a total of 181 decimal.

Hexadecimal is counting to base 16. Each digit has 16 possible states, from 0 - 9 and A-F. The value 10 in hex is decimal 16. Having a number base which is a power of two is very useful, because each digit is represented by several bits. If I want to convert a long binary number into hex I simply break the number into sequences of four bits and then convert each four bit item into the corresponding hex digit:

10101101011011101101
1010 1101 0110 1110 1101
0xA  0xD  0x6  0xE  0xD

Bit Number

Power of 2

HEX value

7

128

0x80

6

64

0x40

5

32

0x20

4

16

0x10

3

8

0x08

2

4

0x04

1

2

0x02

0

1

0x01